<template>
  <div id="shop-car">
    <nav-bar class="nav-bar">
      <div slot="center">购物车({{this.$store.getters.getGoodsLength}})</div>
    </nav-bar>
    <b-scroll class="shop-car-scroll"
              ref="BScroll">
      <shop-car-item-list></shop-car-item-list>
    </b-scroll>
    <shop-car-nav></shop-car-nav>
  </div>
</template>

<script>
import NavBar from "@/components/common/navbar/NavBar"
import BScroll from "@/components/common/bScroll/BScroll"
import ShopCarItemList from "./childComponents/ShopCarItemList"
import ShopCarNav from "./childComponents/ShopCarNav"

export default {
  name: "ShopCar",
  components: {
    NavBar,
    ShopCarItemList,
    BScroll,
    ShopCarNav
  },
  activated() {
    this.$nextTick(() => {
      this.$refs.BScroll.refresh();
      this.$store.dispatch('checkGoodsIsChose');
    })
  }
}
</script>

<style scoped>
  #shop-car {
    background-color: #f6f6f6;
  }

  .nav-bar {
    background-color: var(--color-tint);
    font-size: 20px;
    color: #ffffff;
  }
  .shop-car-scroll {
    height: calc(100vh - 149px);
    overflow: hidden;
  }
</style>
